import time
def computer_runtime(func):
    #把方法扩展之后的新方法
    def running():
        start_time = time.time()
        print(start_time)
        func()
        end_time = time.time()
        print(end_time)
        print('耗时：{:.4f}s'.format(end_time - start_time))
    return running
@computer_runtime
def run():
    #定义一个函数来检验上面打印函数执行时间的方法靠谱不
    l = [x**2 for x in range(1000)]
run()
